package object2;


import java.lang.Override;

/**
 * 面向对象编程（中级部分）练习
 */
public class Object2Exercise04 {

    public static void main(String[] args) {

        /*
            设计父类-员工类
            子类：工人类(Worker)、农民类(Peasant)、教师类(Teacher)、科学家类(Scientist)、服务生类(Waiter)
            1)工人、农民、服务生只有基本工资 sal
            2)教师除基本工资外，还有课酬(元/天) classDay,classSal
            3)科学家除基本工资外，还有年终奖 bonus
            4)编写一个测试类，将各种类型的员工的全年工资打印出来
         */
        Wor wor = new Wor("张三", 4000.0);
        wor.printInfo();

        Pea pea = new Pea("李四", 3000.0);
        pea.printInfo();

        Wai wai = new Wai("王五", 3500.0);
        wai.printInfo();

        Tea tea = new Tea("赵六", 4500.0, 270, 100);
        tea.printInfo();

        Sci sci = new Sci("孙七", 6000.0, 100000.0);
        sci.printInfo();

    }
}

class Emp {

    public String name;

    public double baseSalary;

    public Emp(String name, double baseSalary) {
        this.name = name;
        this.baseSalary = baseSalary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getBaseSalary() {
        return baseSalary;
    }

    public void setBaseSalary(double baseSalary) {
        this.baseSalary = baseSalary;
    }

    public void printInfo() {
        System.out.println("姓名=" + name + ",工资=" + baseSalary * 12);
    }
}

class Wor extends Emp {

    public Wor(String name, double baseSalary) {
        super(name, baseSalary);
    }

    @Override
    public void printInfo() {
        super.printInfo();
    }
}

class Pea extends Emp {

    public Pea(String name, double baseSalary) {
        super(name, baseSalary);
    }

    @Override
    public void printInfo() {
        super.printInfo();
    }
}

class Tea extends Emp {

    public int classDay;

    public double classSal;

    public Tea(String name, double baseSalary, int classDay, double classSal) {
        super(name, baseSalary);
        this.classDay = classDay;
        this.classSal = classSal;
    }

    public int getClassDay() {
        return classDay;
    }

    public void setClassDay(int classDay) {
        this.classDay = classDay;
    }

    public double getClassSal() {
        return classSal;
    }

    public void setClassSal(double classSal) {
        this.classSal = classSal;
    }

    @Override
    public void printInfo() {
        double salary = this.baseSalary * 12 + this.classDay * this.classSal;
        System.out.println("姓名=" + this.name + ",工资=" + salary);
    }
}

class Sci extends Emp {

    public double bonus;

    public Sci(String name, double baseSalary, double bonus) {
        super(name, baseSalary);

    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }

    @Override
    public void printInfo() {
        double salary = this.baseSalary * 12 + this.bonus;
        System.out.println("姓名=" + this.name + ",工资=" + salary);
    }
}

class Wai extends Emp {

    public Wai(String name, double baseSalary) {
        super(name, baseSalary);
    }

    @Override
    public void printInfo() {
        super.printInfo();
    }
}